package com.yu;

import com.yu.service.impl.HelloServiceImpl;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsServerFactoryBean;

public class Server {
    public static void main(String[] args) {
        //发部服务的工厂（不理解，代理的意思吗？）
        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
        //服务端的地址
        factory.setAddress("http://localhost:8010/ws/hello");
        //服务类，服务端展示的实现类
        factory.setServiceBean(new HelloServiceImpl());
        //添加日志输入、输出拦截器，观察soap请求，soap响应内容
        factory.getInInterceptors().add(new LoggingInInterceptor());
        factory.getOutFaultInterceptors().add(new LoggingOutInterceptor());
        //发布服务
        factory.create();
        //发部服务成功，控制台打印信息
        System.out.println("发布服务成功，端口8010");

    }
}
